import * as _ from 'lodash';
import { Queue } from '$domain/service/queue';
export class SimulationQueueManager {
  private static _instance: SimulationQueueManager;

  public static get Instance() {
    if (!this._instance) { this._instance = new SimulationQueueManager(); }
    return this._instance;
  }

  private _queues: { [queueName: string ]: Queue<string> } = {};

  createIfNotExist(queueName: string, queue: Queue<string>) {
    if (!this._queues[queueName]) {
      this._queues[queueName] = queue;
    }
    return this._queues[queueName];
  }

  getByName(queueName: string) {
    return this._queues[queueName];
  }

  delete(queueName: string) {
    delete this._queues[queueName];
  }
}